Ext.ux.OutpubExcelButton = Ext.extend(Ext.Button,{
			text : '导出excel',
			iconCls : 'page_excel',
			handler: function(){
			if(this.grid!=null)
				this.grid.outExcelXml(false,this.title);
			else
			 	this.ownerCt.ownerCt.outExcelXml(false,this.title);
			}
		});
Ext.reg('outputExcelButton', Ext.ux.OutpubExcelButton);
var closebtn={
	text : '关闭',
	iconCls : 'table_close',
	handler : function() {
		frame_center.remove(frame_center.getActiveTab());

	}
}

Ext.ux.ClosePageButton = Ext.extend(Ext.Button, closebtn);
Ext.reg('closePage', Ext.ux.ClosePageButton);


 var  colModelJsButtonCfg={
	text:'保存列设置',
	filename:'',
	baseUrl:'../sysControl/SetColModelController/set/',
	iconCls:'table_gear',
	menuid:'',
	smname:'mysm',
	getOwnerCt:function (ownerCt){
	   	if(!ownerCt)
	   	  return null;
	   	 if(ownerCt.colModel){
	   	  return ownerCt;	
	   	 }else{
	   	  return this.getOwnerCt(ownerCt.ownerCt);
	   	 }
						   	
   },
    getValue:function(object){
   		if(object!==null)
			return object ;
   		else
   			return "";
   },
   getFuncStr:function(func){
   	func=Ext.util.Format.trim(func);
   	
   	if(func=='')
   		return "";
	var startIndex=func.indexOf('function')+8;
	var endIndex=func.indexOf('(');
	var fnname=Ext.util.Format.trim(func.substring(startIndex,endIndex));
	if(fnname=='')
		return func;
	else{
		if(fnname==='undefin')
			return ""; 
		else
			return fnname;
	}
   },
	handler:function(){
		var dfn=new Ext.grid.Column().renderer;
		var ss=[];
		if(!this.grid)
			this.grid=this.getOwnerCt(this.ownerCt);
		var length=this.grid.colModel.config.length;
		if(this.smname!==null){
			ss.push(this.smname);
			ss.push('`');
		}
		for(var i=1;i<length;i++){
			var columns=this.grid.colModel.config[i];
			if(i!=1)
				ss.push('`');
			ss.push(this.getValue(columns.id));ss.push('~');
			ss.push(columns.header);ss.push('~');
			ss.push(columns.dataIndex);ss.push('~');
			ss.push(this.getValue(columns.sortable));ss.push('~');
			ss.push(this.getValue(columns.hidden));ss.push('~');
			ss.push(this.getValue(columns.fixed));ss.push('~');
			ss.push(this.getValue(columns.resizabl));ss.push('~');
			if(columns.locked===true)ss.push('true~');else ss.push("~");
			if(dfn!==columns.renderer){ss.push(this.getFuncStr(columns.renderer.toString()));};ss.push("~");
			ss.push(this.getValue(columns.align));ss.push('~');
			ss.push(columns.width);
		}
				

		var colModel=ss.join("");
		Ext.Ajax.request({
		url:this.baseUrl+this.url,	
		method : 'POST',
		success : function(request) {var message = request.responseText;alertpand(message)},
		failure : function(request) {Ext.Msg.alert("错误", "与后台联系的时候出现了问题");},
		params:{colModel:colModel,menuid:this.menuid}});
	}
}
Ext.ux.colModelJsButton =Ext.extend(Ext.Button,colModelJsButtonCfg);
Ext.reg('colModelJsButton', Ext.ux.colModelJsButton);